﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:designer="clr-namespace:Glass.Design.Designer" xmlns:design="clr-namespace:Glass.Design">
    <Style TargetType="{x:Type designer:DesignerItem}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type designer:DesignerItem}">
                    <Border x:Name="Border" 
                            BorderThickness="{TemplateBinding BorderThickness}" 
                            BorderBrush="{TemplateBinding BorderBrush}" 
                            Background="{TemplateBinding Background}">
                        <Grid>
                            <ContentPresenter />
                            <design:DragControl x:Name="PART_DragControl" Cursor="SizeAll" />
                            <Border x:Name="SelectionBorder" Visibility="Collapsed"  BorderBrush="{x:Static SystemColors.HighlightBrush}" BorderThickness="2" />
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter TargetName="SelectionBorder" Property="Visibility" Value="Visible" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsEditing"  Value="True" />                                
                            </MultiTrigger.Conditions>
                            <Setter TargetName="PART_DragControl" Property="Visibility" Value="Hidden" ></Setter>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type designer:Designer}">
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <Canvas IsItemsHost="True" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type designer:Designer}">
                    <Border
                        Background="{TemplateBinding Background}">
                        <ItemsPresenter />
                    </Border>

                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>